import React from 'react';
import Button from 'antd/lib/button';

export default class {
    init = (modelName, actionName) => {
        this.modelName = modelName;
        this.actionName = actionName;
    }

    // 展示前
    beforeShow = () => {

    }

    // 展示弹窗
    show = () => {
        this.beforeShow();
        this.models[this.modelName].set({
            visible: true
        });
    }

    // 关闭前
    beforeClose = () => {

    }

    // 关闭弹窗
    close = () => {
        this.beforeClose();
        this.models[this.modelName].set({
            visible: false
        });
    }

    // 点击确认按钮
    onOk = () => {
        this.close();
    }

    // 渲染按钮
    renderFooter = () => {
        return (
            <>
                <Button
                    onClick={this.close}
                >
                    取消
                </Button>
                <Button
                    type="primary"
                    onClick={this.onOk}
                >
                    确认
                </Button>
            </>
        );
    }
}